package com.xidian.zhiancloud.controller.luling.RiskIdentificationPart;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.service.luling.RiskIdentificationPart.RiskIdentStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateCustomizer;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
/**
        *风险辨识接口
        * @Author:luling
        * @Date:2021/1/7   15:24
        */
@RestController
@RequestMapping("/RiskIdenStatus")
public class RiskIdentStatusController {
    @Autowired
    private RiskIdentStatusService riskIdentStatusService;
    /**
     * 根据id添加风险辨识信息
     *
     * @param ids ids数组
     * @return  返回ResultDTO对象*/
    @PostMapping ("/insertByIds")
    public ResultDTO<Boolean> insertByIds(Long[] ids) {
        riskIdentStatusService.equals(ids);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     * 根据state获取风险辨识信息
     *
     * @param state 风险辨识state对象
     * @return  返回风险辨识对象
     */
    @GetMapping("/getById/{state}")
    public ResultDTO<Object> getById(
            @PathVariable String state) {
        return ResultDTO.successOf(riskIdentStatusService.getById(state), GeneralResponseEnums.SUCCESS);
    }
   // 通过分析评价类型查询
   /*@GetMapping("/getById/{type}")
    public ResultDTO1  getById(
            @PathVariable String type){
        return ResultDTO1.successOf(riskIdentStatusService.getById(type),GeneralResponseEnums.SUCCESS);
    }*/
    /**
     * 列表查询
     *
     * @param  riskName 风险名称
     * @param deadlineIden 辨识截止时间
     * @param  type  类型
     * @param   key    关键字
     * @param current   分页偏移量
     * @param size    每一页的数量
     * @return 返回设施设备列表
     **/
   @GetMapping("/getList")
   public ResultDTO<Object>getList(@RequestParam(value = "riskName", required = false) String riskName,
                            @RequestParam(value = "deadlineIden", required = false) Date deadlineIden,
                            @RequestParam(value = "type", required = false) String type,
                            @RequestParam(value = "key", required = false) String key,
                            @RequestParam(value = "current", required = true) int current,
                            @RequestParam(value = "size", required = true) int size) {
       return ResultDTO.successOf(riskIdentStatusService.getList(riskName, deadlineIden,type,key,current, size), GeneralResponseEnums.SUCCESS);
   }
}
